package cn.hesion.nio;
/**
 * ClassName: BasicBuffer <br/>
 * Description: <br/>
 * date: 2021/1/21 12:20<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */

import java.nio.IntBuffer;

/**
 * @program: NettyLearn
 * @description: 基础Buffer
 * @author: hesion
 * @create: 2021-01-21 12:20
 **/
public class BasicBuffer {
    public static void main(String[] args) {
        IntBuffer allocate = IntBuffer.allocate(5);
        allocate.put(0);
        allocate.put(1);
        allocate.put(2);
        allocate.put(3);
        allocate.put(4);

        allocate.flip();
        allocate.position(1);
        while (allocate.hasRemaining()){
            System.out.println(allocate.get());
        }
    }
}
